<template>
	<view v-if="isShow" class="BookLoading">
		<view class="loading-wrapper">
			<image src="../static/loading.gif"></image>
		</view>
		<view class="loading-text">{{text}}</view>
	</view>
</template>

<script>
	export default {
		name:"bookLoading",
		props:{
			text:{
				type:String,
				default:'加载中...'
			},
			visible:{
				type:Boolean,
				default:false
			}
		},
		data() {
			return {
				isShow:this.visible
			};
		},
		watch:{
			visible(v){
				this.isShow = v
			},
			isShow(v){
				this.$emit('update:visible',v)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.BookLoading{
		position: fixed;
		width: 100%;
		height: 100%;
		background-color: rgba(0,0,0,.5);
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		z-index: 100;
		
		.loading-wrapper{
			width: 300rpx;
			height: 300rpx;
			image{
				width: 100%;
				height: 100%;
			}
		}
		
		.loading-text{
			color: white;
			margin-top: 20rpx;
			
		}
	}
</style>
